import request from '@/utils/request';

// 认证
export function certification(data) {
    return request({
        url: '/v1/user_applies/apply_businesser',
        method: 'post',
        data
    })
};

// 增加商品
export function newGoodsBtn(data, id) {
    return request({
        url: `/v1/businesses/${id}/create_product`,
        method: "post",
        data
    })
};

// 店铺商品列表
export function shopGoodsList(page, Sid) {
    return request({
        url: `/v1/products?business_id=${Sid}&page=${page}`,
        method: 'get',
    })
};

// excel文件上传
export function uploadExcel(data) {
    return request({
        url: '/v1/businesses/1/import_products',
        method: 'post',
        data
    })
};

// 申请商铺列表
export function ovistoreList() {
    return request({
        url: "/v1/businesses",
        method: 'get',
    })
};

// 申请店铺
export function ovistore(data) {
    return request({
        url: '/v1/businesses',
        method: 'post',
        data
    })
};

// 删除店铺信息
export function deleteStore(id) {
    return request({
        url: `/v1/businesses/${id}/off_show`,
        method: 'post'
    })
};

// 编辑店铺
export function editorStore(id, data) {
    return request({
        url: `/v1/businesses/${id}`,
        method: 'put',
        data
    })
};

// 店铺商品
export function shopGoods(id, page) {
    return request({
        url: `/v1/products?business_id=${id}&page=${page}`,
        method: 'get',
    })
};

// 店铺品牌系列
export function brandSeries(id) {
    return request({
        url: `/v1/homes/${id}/business_brand_series`,
        method: 'get',
    })
}

// 店铺选择的品牌
export function bindBrands(id) {
    return request({
        url: `/v1/business_brands/${id}/brands`,
        method: 'get',
    })
}

// 店铺购物车列表
export function storeCartList(id) {
    return request({
        url: `/v1/cart?business_id=${id}`,
        method: 'get'
    })
}

// 商铺订单列表
export function getOrders(id, index) {
    return request({
        url: `/v1/business_orders/${id}/orders?page=${index}`,
        method: 'get',
    })
}

// 上架
export function shelves(id) {
    return request({
        url: `/v1/products/${id}/on_sale`,
        method: 'post'
    })
}

// 下架
export function unshelve(id) {
    return request({
        url: `/v1/products/${id}/off_sale`,
        method: 'post'
    })
}

// 商家商品列表
export function isshopGoods(page, id) {
    return request({
        url: `/v1/business_products?business_id=${id}&page=${page}`,
        method: 'get'
    })
}

// 商品编辑
export function goodsEditor(id, data) {
    return request({
        url: `/v1/business_products/${id}/update`,
        method: 'put',
        data
    })
}

// 店铺信息
export function sxgroup(id) {
    return request({
        url: `/v1/businesses/${id}`,
        method: 'get'
    })
}

// 店铺关联店铺
export function associatedBrand(id, data) {
    return request({
        url: `/v1/business_brands/${id}/brands`,
        method: 'post',
        data
    })
}

// 商家信息
export function businessInfo() {
    return request({
        url: `/v1/user_businesser_infos`,
        method: 'get'
    })
}

// 支持的物流公司
export function logisticsCompany() {
    return request({
        url: '/v1/expresses',
        method: 'get'
    })
}

// 商家发货
export function merchantShipp(id, data) {
    return request({
        url: `/v1/order_expresses/${id}/ships`,
        method: 'post',
        data
    })
}

// 新增店员
export function addclerk(data) {
    return request({
        url: '/v1/auth/business_register',
        method: 'post',
        data
    })
}

// 店员列表
export function assistantList(id) {
    return request({
        url: `/v1/businesses/${id}/users`,
        method: 'get'
    })
}

// 确认发票
export function isinvoiceapi(id, data) {
    return request({
        url: `/v1/orders/${id}/invoice_status`,
        method: 'post',
        data
    })
}

// 账号停用
export function accountdisabl(id,data) {
    return request({
        url: `/v1/businesses/${id}/user_remove`,
        method: 'post',
        data
    })
}
